home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 36
/
PC Gamer IT CD 36 2-2.iso
/
VIGDEMO
/
data1.cab
/
Assets
/
scripts
/
bomb.e
< prev
next >
Wrap
Text File
|
1998-09-21
|
4KB
|
623 lines
int Initialize(string type)
{
global string gMessage;
global real gInRadius = 60.0;
global real gOutRadius = 90.0;
global int gNetwork = 0;
global int state = 0;
global int hitValue = 20;
global real gTimer = 20.0;
global real gExplodeRadius = 40.0;
global int gStartSound = 7;
global int gProgressSound = 18;
global int gEndSound = 27;
global int gStyle = 2;
global real gMass = 5.0;
global int gWantToStart = 0;
Reset("dummy");
return 0;
}
int startsound(string soundname)
{
gStartSound = GetSoundIndex(soundname);
}
int endsound(string soundname)
{
gEndSound = GetSoundIndex(soundname);
}
int progresssound(string soundname)
{
gProgressSound = GetSoundIndex(soundname);
}
int sethardstyle()
{
gStyle = 0;
}
int Reset(string dummy)
{
if (gWantToStart != 1) {
state = 0;
wakeupTime = -1.0;
}
print("reset");
SetStyle(thisObject,gStyle);
SetCollidableProperties(thisObject,1,0);
return 0;
}
int exploderadius(string str)
{
gExplodeRadius = Str2Real(str);
}
int inradius(string str)
{
gInRadius = Str2Real(str);
}
int timer(string str)
{
gTimer = Str2Real(str);
}
int network(string str)
{
gNetwork = Str2Int(str);
}
int outradius(string str)
{
gOutRadius = Str2Real(str);
}
int damage(string str)
{
hitValue = Str2Int(str);
return 0;
}
int start(string dummy)
{
real time ;
time = GetTime(thisObject);
gWantToStart = 1;
if (state == 0)
{
state = 1;
PlaySound(thisObject,gStartSound);
wakeupTime = time + 1.0;
}
return 0;
}
int Explosion(int param)
{
real time ;
time = GetTime(thisObject);
state = 2;
LaunchEFX(thisObject,2,0);
FireSaveInfo(thisObject,hitValue,0,gMass,1);
Explode(thisObject,hitValue,gExplodeRadius,gMass);
SetStyle(thisObject,4);
PlaySound(thisObject,gEndSound);
SetCollidableProperties(thisObject,0,0);
return 0;
}
int Colliders(string dummy)
{
map::iterator ix;
map::iterator iy;
map objInList;
if (IsAuthoritative(thisObject) != 1)
return;
objInList = Collisions(thisObject,0,1,0);
ix = begin(objInList);
iy = end(objInList);
if (ix != iy)
{
state = 0;
}
return 0;
}
int TimedEvent(int input)
{
real time;
time = GetTime(thisObject);
if (state == 1)
{
PlaySound(thisObject,gProgressSound);
gTimer = gTimer - 1.0;
if (gTimer <= 0.0)
{
state = 2;
}
wakeupTime = time + 1.0;
SetTimer(thisObject,gTimer);
}
else if (state == 2)
{
Explosion(0);
SendMessage(thisObject,gOutRadius,gNetwork);
Remove(thisObject);
wakeupTime = -1.0;
SetTimer(thisObject,-1.0);
}
else
wakeupTime = -1.0;
return 0;
}